const isDev = process.env.NODE_ENV === 'development'

// 百度统计
const baiduAnalytics = ({route, router}) => {
  if (typeof _hmt === 'undefined' || isDev) {
    // 服务端渲染时候, _hmt 是 undefined
    return
  }
  const {name, params, query, hash} = route
  const {href} = router.resolve({name, params, query, hash})
  // eslint-disable-next-line
  _hmt.push(['_trackPageview', href])
}

export default ({route, router}) => {
  baiduAnalytics({route, router})
};
